import type { AddressItem, Logistics, OrderDetail, OrderPre } from '@/types/order'
import request from '@/utils/request'

// 获取药品订单预支付信息
export const getMedOrderPreInfo = (params: { prescriptionId: string }) =>
  request<OrderPre>('/patient/medicine/order/pre', 'GET', params)

// 获取收货地址列表
export const getAddressList = () => request<AddressItem[]>('/patient/order/address', 'GET')

// 生成药品订单
export const createMedOrder = (params: { id: string; addressId: string }) =>
  request<{ id: string }>('/patient/medicine/order', 'POST', params)

// 获取药品支付结果
export const getMedOrderResult = (id: string) =>
  request<OrderDetail>(`/patient/medicine/order/detail/${id}`, 'GET')

// 获取物流信息
export const getLogistics = (id: string) =>
  request<Logistics>(`/patient/order/${id}/logistics`, 'GET')
